﻿namespace CompanyPayRollSystem.BusinessLayer
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using CompanyPayRollSystem.Database;
   
    /// <summary>
    /// Base class for all entities access objects
    /// </summary>
    public class EntityManager
    {
        /// <summary>
        /// Database context.
        /// </summary>
        private static Database.EmployeePayRollDBDataContext context;
       
        /// <summary>
        /// Initializes a new instance of the EntityDAO class.
        /// </summary>
        public EntityManager()
        {
            context = new EmployeePayRollDBDataContext();
        }

        /// <summary>
        /// Gets the context.
        /// </summary>
        public static EmployeePayRollDBDataContext Context
        {
            get 
            {
                if (context == null)
                {
                    context = new EmployeePayRollDBDataContext();
                }

                return context; 
            }
        }
    }
}